iT邦幫忙

DAY 1
2

MySQL漫談,由使用Python撰寫之MySQL工具程式出發系列 第 1

使用Python撰寫MySQL工具程式 (1)

  • 分享至 

  • xImage
  •  

MySQL是應用廣泛的資料庫,除了原廠以外,也有許多公司或個人開發不少有用的工具程式.
Python是一靈巧好用的語言.用來開發自用的工具程式,十分方便.
在此先介紹一個 MySQL Quick Report,協助使用者能夠迅速的對MySQL的狀況有一概觀,
今天先把產生的報告,列出來,後續將對各段落說明.

    #### Hitomi MySQL Qucik Report Version:1.0 ####
        Report Create Time - 2012-10-04 11:03:52
------------------------------------------------------------
Basic Information Section:
                Login User - myperf@localhost
                   Version - 5.5.24-0ubuntu0.12.04.1-log
         MySQL Server Name - asami
         MySQL Server Time - 2012-10-04 11:03:52
    MySQL Server Boot Time - 2012-10-04 08:01:34
      MySQL Server Up Time - 0 Days  3 Hours  2 Mins 18 Sec
 Uptime Since Flush Status - 0 Days  3 Hours  2 Mins 18 Sec
    Default Storage Engine - InnoDB
                 Databases - 4
                 Processes - 2
                   datadir - /var/lib/mysql/
                  pid_file - /var/run/mysqld/mysqld.pid
                    socket - /var/run/mysqld/mysqld.sock
------------------------------------------------------------
Engine Section:
        PERFORMANCE_SCHEMA - YES
                 BLACKHOLE - YES
                    InnoDB - DEFAULT
                MRG_MYISAM - YES
                    MyISAM - YES
                    MEMORY - YES
                       CSV - YES
                   ARCHIVE - YES
------------------------------------------------------------
Table Cache Section:
              Cache Number -     400 
               Open Tables -      48 
             Usage Percent -   12.00 %
------------------------------------------------------------
Query Cache Section:
          Query Cache type -        ON
                      Size -   16.00 M
                      Free -   15.98 M
                      Used -    0.02 M
             Usage Percent -    0.10 M
------------------------------------------------------------
InnoDB Section:
                   Version -     1.1.8
            File Per Table -        ON
          Buffer Pool Size -  128.00 M
          Buffer Pool Fill -    5.48 %
         Buffer Pool Dirty -    0.00 %
          Innodb Page Size -      16 K
   InnoDB Log File Numbers -       2 
      Single Log File Size -    5.00 M
      InnoDB Log File Size -   10.00 M
    InnoDB Log Buffer Size -    8.00 M
------------------------------------------------------------
MyISAM Section:
           Key Buffer Size -   16.00 M
      Used Key Buffer Size -    2.92 M
              Used Percent -   18.24 %
           Unflush Percent -    0.00 %
------------------------------------------------------------
Buffer/Heap Section:
          Sort Buffer Size -    2.00 M
          Join Buffer Size -  128.00 K
          Read Buffer Size -  128.00 K
   Read Random Buffer Size -  256.00 K
   Bulk Insert Buffer Size -    8.00 M
       Max Heap Table Size -   16.00 M
            Tmp Table Size -   16.00 M
           Max Packet Size -   16.00 M
------------------------------------------------------------
Slow Log Section:
                  Slow Log -        ON
    Slow Query Launch Time -       2 Sec
             Slow Log File - /var/log/mysql/mysql-slow.log
------------------------------------------------------------
              Working Time - 0.059873 second

下一篇
使用Python撰寫MySQL工具程式 (2)
系列文
MySQL漫談,由使用Python撰寫之MySQL工具程式出發30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 則留言

0
patrickcheng
iT邦新手 4 級 ‧ 2012-10-04 12:08:29

對DBA來說,值得學習。
期待你的解說囉。

我要留言

立即登入留言